package com.litemall.user.controller;

import com.litemall.pojo.User;
import com.litemall.response.UserOrderDTO;
import com.litemall.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : Areli
 * @date : 2020/4/19 21:35
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    UserService userService;

    @GetMapping("/{username}")
    public User findOne(@PathVariable("username") String username){
        return userService.findOne(username);
    }

    @GetMapping
    public List<UserOrderDTO> findUserOrders(){
        return  userService.findUserOrders();
    }
}
